<template lang='pug'>
  .page
    Table.hasTitle-table.beautiful-table(width="100%" :loading="loading" stripe :columns="thead" :data="listData")
      template(slot-scope="{ row, index }" slot="typeName")
        .u-d-info(@click="gotoPage(row.menuCode)") {{row.typeName}}
</template>

<script>
  import TaskApi from '@/api/Task.api.js'

  export default {
    name:'',
    props:{},
    data () {
      return {
        loading: false,
        thead: [
          {
            title: '任务类型',
            minWidth: 200,
            align: 'center',
            slot: 'typeName'
          },
          {
            title: '最大同步时间',
            minWidth: 200,
            align: 'center',
            key: 'maxSyncTime',
            render: (h, params) => {
            let row = params.row
            let times = row.maxSyncTime.slice(0, 19).replace(/T/g, ' ')
            return h('span', times)
          }
          },
          {
            title: '创建时间',
            minWidth: 200,
            align: 'center',
            render: (h, params) => {
            let row = params.row
            let times = row.createdOn.slice(0, 19).replace(/T/g, ' ')
            return h('span', times)
          }
          },
          {
            title: '更新时间',
            minWidth: 200,
            align: 'center',
            render: (h, params) => {
            let row = params.row
            let times = row.updatedOn.slice(0, 19).replace(/T/g, ' ')
            return h('span', times)
          }
          }
        ],
        listData: []
      }
    },
    watch: {},

    components: {},

    computed: {},

    beforeMount() {},

    mounted() {
      this.getList()
    },

    methods: {
      getList () {
        TaskApi.GetTaskProgressList().then(res => {
          console.log(res)
          if (res.data.success) {
            this.listData = res.data.data
          } else {
            this.$Message.error(res.data.message)
          }
        })
      },
      gotoPage (code) {
        this.$router.push({ name: code })
      }
    }


  }

</script>
<style lang='less' scoped>

</style>